package ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller;

import java.sql.ResultSet;

import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller.historyRFC.AddHistoryinDBThread;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.model.History;

public class HistoryMaker
{
	private History history;
	
	public History createHistoryEntry(ResultSet rs)throws Exception
	{
		history = new History(rs.getString(History.TC_ID));
		history.setTimestamp(rs.getTimestamp(History.TC_TIMESTAMP));
		history.setUser(rs.getString(History.TC_USER));
		history.setSource(rs.getString(History.TC_SOURCE));
		history.setDescription(rs.getString(History.TC_DESCRIPTION));
		return history;
	}
	
	
	public void addHistoryInDBTable(String userFullName, String source, String description) {

		new AddHistoryinDBThread(userFullName, source, description).start();
	}
}